package com.example.smartcity.Mappers;

import com.example.smartcity.Entity.Collect;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CollectionMapper {
    @Insert("INSERT INTO collection (user_id, article_id) VALUES (#{userId}, #{articleId})")
    void addToCollection(int userId, int articleId); // 添加到收藏夹
    @Select("Select * from collection where user_id = #{user_id} and article_id = #{articleId}")
    Collect isCollection(int user_id, int articleId);
    @Delete("DELETE FROM collection WHERE user_id = #{userId} and article_id = #{articleId}")
    void deleteCollection(int userId,int articleId);
    @Select("SELECT article_id FROM collection WHERE user_id = #{userId}")
    List<Integer> ArticleIdList(int userId);
}
